<template>
	<view class="content">
		<view class="body_head" click="backurl">
			<text class="icon-fanhui iconfont"></text> 补充信息
		</view>

		<view class="vluebox">

			<view class="vlue_tit"> 补充工作信息 </view>

			<view class="vlue_more line">
				<view class="value_l"> 公司名称 </view>
				<view class="value_r">
					<input type="text" @input="getname" placeholder="请输入">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 公司性质 </view>
				<view class="value_r">
					<input type="text" @input="gettype" placeholder="请输入">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 公司电话 </view>
				<view class="value_r">
					<input type="number" @input="getcpphone" maxlength="11" placeholder="请输入">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 公司地址 </view>
				<view class="value_r">
					<input type="text" @input="getcpadd" placeholder="请输入">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 工作时间 </view>
				<view class="value_r">
					<input type="text" @input="getcptime" placeholder="请输入工作时间（年）">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 工作岗位 </view>
				<view class="value_r">
					<input type="text" @input="getcpwork" placeholder="请输入工作岗位">
				</view>
			</view>

			<view class="vlue_mores line">
				<view class="values_l"> 社保证明</view>
				<view class="values_r">
					<image @click="beforeUpload" :src=" simg ? simg : '/static/add.png' " mode=""></image>
				</view>
			</view>
			<view class="vlue_mores ">
				<view class="values_l">工作证明 </view>
				<view class="values_r">
					<image @click="beforeUploads" :src=" wimg ? wimg : '/static/add.png' " mode=""></image>
				</view>
			</view>

		</view>

	<view class="vluebox">
			<view class="vlue_tit"> 银行信息 </view>
			<view class="vlue_more line">
				<view class="value_l"> 银行卡号 </view>
				<view class="value_r">
					<input type="number" @input="getbank" placeholder="请输入">
				</view>
			</view>
			<view class="vlue_more ">
				<view class="value_l"> 现居地 </view>
				<view class="value_r">
					<input type="text" @input="getaddress" placeholder="请输入">
				</view>
			</view>
		</view>
		
		<view class="vluebox">
			<view class="vlue_tit"> 紧急联系人 </view>
			<view class="vlue_more line">
				<view class="value_l"> 亲属1姓名  </view>
				<view class="value_r">
					<input type="text" @input="getsosname" placeholder="请输入亲属1姓名">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 亲属1电话 </view>
				<view class="value_r">
					<input type="text" maxlength="11" @input="getsosmobile" placeholder="请输入亲属1电话">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 亲属2姓名 </view>
				<view class="value_r">
					<input type="text" @input="getsosname1" placeholder="请输入亲属2姓名">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 亲属2电话 </view>
				<view class="value_r">
					<input type="text" maxlength="11" @input="getsosmobile1" placeholder="请输入亲属2电话">
				</view>
			</view>
			
			<view class="vlue_more line">
				<view class="value_l">同事姓名 </view>
				<view class="value_r">
					<input type="text" @input="getsosname2" placeholder="请输入同事姓名">
				</view>
			</view>
			<view class="vlue_more line">
				<view class="value_l"> 同事电话 </view>
				<view class="value_r">
					<input type="text" maxlength="11" @input="getsosmobile2" placeholder="请输入同事电话">
				</view>
			</view>
			
			<view class="vlue_more line">
				<view class="value_l"> 朋友姓名 </view>
				<view class="value_r">
					<input type="text" @input="getsosname3" placeholder="请输入朋友姓名">
				</view>
			</view>
			<view class="vlue_more ">
				<view class="value_l"> 朋友电话 </view>
				<view class="value_r">
					<input type="text" maxlength="11" @input="getsosmobile3" placeholder="请输入朋友电话">
				</view>
			</view>
		</view>


		<view class="footer_btn" @click="submits">
			确 认
		</view>


	</view>

</template>



<script>
	import {
		curl
	} from 'common/api.js';
	import {
		baseUrl
	} from 'common/config.js';
	export default {
		data() {
			return {
				id: '',
				simg: '',
				wimg: '',
				cptype: '',
				cpname: '',
				cpphone: '',
				cptime: '',
				cpwork: '',
				sosname: '',
				sosmobile: '',
				cpadd: '',
				bank:'',
				address:'',
				sosname1: '',
				sosmobile1: '',
				sosname2: '',
				sosmobile2: '',
				sosname3: '',
				sosmobile3: '',
			}
		},
		onLoad(ret) {
			this.id = ret.id
		},
		methods: {
			submits() {
				var that = this;

				curl('daikuan/setdaikuan', {
					id: this.id,
					simg: this.simg,
					wimg: this.wimg,
					cptype: this.cptype,
					cpname: this.cpname,
					cpphone: this.cpphone,
					cpadd: this.cpadd,
					cptime: this.cptime,
					cpwork: this.cpwork,
					sosname: this.sosname,
					sosmobile: this.sosmobile,
					sosname1: this.sosname1,
					sosmobile1: this.sosmobile1,
					sosname2: this.sosname2,
					sosmobile2: this.sosmobile2,
					sosname3: this.sosname3,
					sosmobile3: this.sosmobile3,
					bank: this.bank,
					address: this.address,
					
				}).then((res) => {
					console.log('************');
					console.log(res);

					uni.showToast({
						title: res.msg,
						icon: 'none'
					})

					if (res.code == 1) {
						setTimeout(function() {
							uni.navigateTo({
								url: '/pages/success/success?id=' + res.data.id
							});
						}, 900)
					}
				});
			},
			
			getsosmobile3(ret) {
				this.sosmobile3 = ret.detail.value
			},
			getsosname3(ret) {
				this.sosname3 = ret.detail.value
			},
			
			getsosmobile2(ret) {
				this.sosmobile2 = ret.detail.value
			},
			getsosname2(ret) {
				this.sosname2 = ret.detail.value
			},
			
			getsosmobile1(ret) {
				this.sosmobile1 = ret.detail.value
			},
			getsosname1(ret) {
				this.sosname1 = ret.detail.value
			},
			
			getaddress(ret){
				this.address = ret.detail.value
			},
			getbank(ret){
				this.bank = ret.detail.value
			},
			getsosmobile(ret) {
				this.sosmobile = ret.detail.value
			},
			getsosname(ret) {
				this.sosname = ret.detail.value
			},
			getcpwork(ret) {
				this.cpwork = ret.detail.value
			},
			getcptime(ret) {
				this.cptime = ret.detail.value
			},
			getcpadd(ret) {
				this.cpadd = ret.detail.value
			},
			getcpphone(ret) {
				this.cpphone = ret.detail.value
			},
			gettype(ret) {
				this.cptype = ret.detail.value
			},
			getname(ret) {
				console.log(ret);
				this.cpname = ret.detail.value
			},

			beforeUpload() {
				var that = this;


				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						var ss = res.tempFilePaths;
						that.imgurl = ss[0];
						uni.uploadFile({
							url: `${baseUrl}` + 'common/upload',
							// url: "/dpc" + 'upload',
							filePath: ss[0], // 本地上传完成后的路径
							name: 'file',
							formData: {},
							success: function(uploadFileRes) {
								var ret = JSON.parse(uploadFileRes.data);
								console.log(ret.data)
								that.simg = ret.data.fullurl
							}
						});

					}
				});
			},
			beforeUploads() {
				var that = this;


				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						var ss = res.tempFilePaths;
						that.imgurl = ss[0];
						uni.uploadFile({
							url: `${baseUrl}` + 'common/upload',
							// url: "/dpc" + 'upload',
							filePath: ss[0], // 本地上传完成后的路径
							name: 'file',
							formData: {},
							success: function(uploadFileRes) {
								var ret = JSON.parse(uploadFileRes.data);
								console.log(ret.data)
								that.wimg = ret.data.fullurl
							}
						});

					}
				});
			},

		}
	}
</script>

<style>
	.values_r>image {
		width: 90rpx;
		height: 90rpx;
	}

	.values_r {
		width: 480rpx;
		font-size: 24rpx;
		text-align: right;
	}

	.values_l {
		font-size: 28rpx;
		text-align: left;

	}

	.vlue_mores {
		width: 660rpx;
		color: #333;
		height: 140rpx;
		margin: auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.value_r {
		width: 480rpx;
		font-size: 28rpx;
		text-align: right;
	}

	.value_l {
		width: 160rpx;
		font-size: 28rpx;
		text-align: left;
	}

	.vlue_more {
		width: 660rpx;
		height: 110rpx;
		margin: auto;
		display: flex;
		align-items: center;
		justify-content: space-around;
		font-size: 28rpx;
		color: #333;
	}

	.vlue_tip {
		width: 670rpx;
		height: 80rpx;
		margin: auto;
		font-size: 26rpx;
		font-weight: 400;
		line-height: 80rpx;
		color: #444;
	}

	.line {
		border-bottom: 1px solid #ececec;
	}

	.vlue_m {
		width: 670rpx;
		height: 90rpx;
		margin: auto;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 90rpx;
	}

	.vlue_tit {
		width: 660rpx;
		height: 90rpx;
		margin: auto;
		font-size: 26rpx;
		line-height: 90rpx;
	}

	.vluebox {
		width: 700rpx;
		height: auto;
		background: #ffffff;
		border-radius: 10rpx;
		margin: 20rpx auto;
	}

	.body_head>text {
		color: #ffffff;
		font-weight: bold;
		font-size: 30rpx;
	}

	.body_head {
		width: 700rpx;
		height: 90rpx;
		line-height: 90rpx;
		margin: auto;
		display: flex;
		align-items: center;
		font-size: 30rpx;
		color: #ffffff;
	}

	.content {
		width: 100%;
		min-height: 100vh;
		background: linear-gradient(to bottom, #00d292 0%, #7ddb59 20%,#fafafa 40%,#fafafa 100%) !important;
	}

	.footer_btn {
		width: 700rpx;
		height: 90rpx;
		margin: 100rpx auto;
		background: #00d229;
		text-align: center;
		line-height: 90rpx;
		color: #ffffff;
		border-radius: 10rpx;
	}
</style>